package com.hzqy.persistence.dao.user;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.hzqy.web.vo.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import com.hzqy.persistence.dao.core.PersistenceDao;

@Repository
public class UserDao extends PersistenceDao<PmsUserVo, Integer> {
	protected final Logger LOG = LoggerFactory.getLogger(getClass());
	
	/*public int addUserOrgRoles(PmsUserVo pmsUserVo){
		return getSqlSession().insert(this.getNamespace() + "selectContentListByCatalogId", pmsUserVo);
	}*/
	
	public int deleteRoleByUserId(int f_pour_userId) {
		String namespace = this.getNamespace();
		return getSqlSession().delete(namespace + "deleteRoleByUserId", f_pour_userId);
	}

	public List<PmsUserVo> findUserList(Map<String,Object> map){
		return this.findList("findUserList", map);
	}
	
	public int findUserCount(PmsUserVo puv) {
		return this.findQuantity("findUserCount", puv);
	}
	
	public List<PmsOrgRoleVo> findAllRoleList() {
		String namespace = this.getNamespace();
		return getSqlSession().selectList(namespace + "findAllRoleList");
	}
	
	public PmsUserVo findUserById(PmsUserVo puv) {
		String namespace = this.getNamespace();
		return getSqlSession().selectOne(namespace + "findUserById",puv);
	}
	
	public PmsRoleVo findRoleById(int f_pour_userId) {
		String namespace = this.getNamespace();
		return getSqlSession().selectOne(namespace + "findRoleById", f_pour_userId);
	}
	
	public List<PmsOrgRoleVo> selectOrgRole(PmsOrgRoleVo porv) {
		String namespace = this.getNamespace();
		return getSqlSession().selectList(namespace + "selectOrgRole", porv);
	}
	public PmsUserVo findUser(PmsUserVo puv) {
		String namespace = this.getNamespace();
		return getSqlSession().selectOne(namespace + "findUser", puv);
	}
}
